<?php
namespace app\http\middleware;

class CorsMiddleware
{
    public function handle($request, \Closure $next)
    {
        $response = $next($request);
        $response->header('Access-Control-Allow-Origin', '*');
        $response->header('Access-Control-Allow-Methods', 'GET,POST,PUT,DELETE,OPTIONS');
        $response->header('Access-Control-Allow-Headers', 'Content-Type,Authorization');
        return $response;
    }
}